<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>

<body>
    <div id="app">
        <div class="father">
            <h3>这里是父组件</h3>
            <child>
                <span slot="demo1">菜单1</span>
                <span slot="demo2">菜单2</span>
                <span slot="demo3">菜单3</span>
            </child>
        </div>
    </div>
    <template id="child">
        <div class="child">
            <h3>这里是子组件</h3>
        
            <slot name="demo3" ></slot>
            <slot name="demo2" ></slot>

        </div>
    </template>
    <script>
        //具名插槽就是在父组件的slot中定义一个slot属性
        //然后在相应的子组件中
        var vm = new Vue({
            el: '#app',
            data: {},
            components: {
                child: {
                    template: '#child'
                }
            }
        });
    </script>
</body>

</html>